#include <cstdio>
#include <cstring>

int cnt, n;
char a[ 16 ];

void dfs2( int p, long long s, long long tar )
{
    int i;
    long long q = 0;    
    if ( p == n )
    {
        if ( s == tar )
            cnt++;
    }
    else
    {
        for ( i = p; i < n; i++ )
        {
            q = q * 10 + a[ i ] - '0';
            dfs2( i + 1, s + q, tar );
        } 
    }
}

void dfs( int p, long long s, bool flag )
{
    int i;
    long long q = 0;
    if ( flag )
        dfs2( p, 0, s );
    q = 0;
    for ( i = p; i < n - 1; i++ )
    {
        q = q * 10 + a[ i ] - '0';
        dfs( i + 1, s + q, 1 );
    } 
}

int main( )
{
    while ( scanf("%s", a) && strcmp( a, "END" ) != 0 )
    {
        cnt = 0;
        n = strlen( a );
        dfs( 0, 0, 0 );
        printf("%d\n", cnt);
    }
    return 0;
}
